@extends('admin.master')
<script src="/js/admin/deviceList.js"></script>

@section('title', '设备列表')
@section('firstItem')
@parent
				<span>设备列表</span>
				<input class="a_indexbg" type="hidden" value="devicelist" />
@stop
@section('searchList')
@parent
				<a class="aaa">搜索</a>
				<div>
					<input class="deviceCodeBox" type="text" value="{{ $condition or '' }}" placeholder="输入用户名或设备编号" />
				</div>
				<div>
					<p>设备状态：</p>
					<span class="deviceCheckBox">{{ $status or '全部' }}</span>
					<div class="deviceCheckDropBox">
						<a>全部</a>
						<a>检修</a>
						<a>缺水</a>
						<a>停机</a>
					</div>
				</div>
@stop
@section('dataTables')
@parent
			<table class="dataTable dataTables" cellspacing="0" cellpadding="0">
				<thead>
					<tr>
						<td>序号</td>
						<td>设备编号</td>
						<td>用户名</td>
						<td>剩余流量</td>
						<td>滤芯1</td>
						<td>滤芯2</td>
						<td>滤芯3</td>
						<td>滤芯4</td>
						<td>滤芯5</td>
						<td>原水TDS</td>
						<td>净水TDS</td>
						<td>水机状态</td>
						<td>记录时间</td>
						<td>经销商</td>
						<td>水机用户</td>
						<td>停机操作</td>
						<td>流量充值</td>
						<td>历史记录</td>
					</tr>
				</thead>
				<tbody>
					@for($i=0, $deviceCount=count($device_list); $i<$deviceCount; $i++)
						@if($device_list[$i]->dec_status == 2)
					<tr class="lessWaterBg">
						@elseif($device_list[$i]->dec_status == 4)
					<tr class="serviceBg">
						@elseif($device_list[$i]->dec_status == 9)
					<tr class="shutDownBg">
						@else
					<tr >
						@endif
						<td><input type="hidden" value="{{ $device_list[$i]->device_id }}" />{{ $i+1 }}</td>
						<td class="deviceCodeCell devicecodeVal">{{ $device_list[$i]->device->code }}</td>
						<td class="userListCell">{{ $device_list[$i]->device->installInfo->customer_name or '尚未录入' }}</td>
						<td class="residueFluxCell">{{ $device_list[$i]->residual_flow }}L</td>
						<td class="filterWidth">{{ $device_list[$i]->filter1 }}%</td>
						<td class="filterWidth">{{ $device_list[$i]->filter2 }}%</td>
						<td class="filterWidth">{{ $device_list[$i]->filter3 }}%</td>
						<td class="filterWidth">{{ $device_list[$i]->filter4 }}%</td>
						<td class="filterWidth">{{ $device_list[$i]->filter5 }}%</td>
						<td>{{ $device_list[$i]->TDS1 }}</td>
						@if($device_list[$i]->TDS2 >= 40)
						<td class="warningBg">
						@else
						<td>
						@endif
						{{ $device_list[$i]->TDS2 }}</td>

						<td>{{ $device_list[$i]->device_status_description }}</td>
						<td>{{ $device_list[$i]->created_at }}</td>
						<td>{{ $device_list[$i]->device->installInfo->dealer or '尚未录入' }}</td>
						@if($userCount = count($device_list[$i]->device->userInfos))
						<td class="userList">
							@for($j=0; $j<$userCount; $j++)
								@if($j == $userCount - 1)
								{{ $device_list[$i]->device->userInfos[$j]->name }}
								@else
								{{ $device_list[$i]->device->userInfos[$j]->name }}、
								@endif
							@endfor
						</td>
						@else
						<td></td>
						@endif
						<td>
						@if($device_list[$i]->device->status !=2)
						<a class="switch">停机</a>
						@else
						<a class="switch">开启</a>
						@endif
						</td>
						<td><input type="hidden" value="{{ $device_list[$i]->device->installInfo->installation_address or '尚未录入' }}" /><a class="payFluxBtn">充值</a></td>
						<td><a href="/admin/device/history?device_id={{ $device_list[$i]->device_id }}">查看</a></td>
					</tr>
					@endfor
				</tbody>
			</table>
@stop
@section('page_num')
<ul class="pagination pagination-lg"> 
	{!! $device_list->render() !!}
</ul>
@stop
@section('infor_promit')
@parent
	<!-- 充值编辑框 -->
	<div class="payFluxBg">
		<div class="payFlux" >
			<p class="titleTxt">充值</p>
			<div class="displayBox p_relative">
				<div>
					<p><span>设备编号:</span><span class="getDeviceCode">64613213456</span></p>
					<p><span>剩余流量:</span><span class="getSurplusFlux"></span></p>
				</div>
				<div>
					<p><span>用户名:</span><span class="getUserList" style="width: 200px;display:inline-block;float: right;"></span></p>
					<p><span>安装地址:</span><span class="getAddress" style="width: 200px;display: inline-block;float: right;"></span></p>
				</div>
				<textarea class="textareaBox Add-ons_txt" placeholder="备注信息："></textarea>
				<div class="payBox">充值流量(L)<input type="text" value="" placeholder="输入正整数" /><label class="required">*</label></div>
				<label class="labelBox payMoneyLabelBox"></label>
			</div>
			<div class="btnBox" >
				<a class="cancelBtn">取消</a>
				<a class="okBtn">确定</a>
			</div>
		</div>
	</div>
	<!-- 开启关闭弹框 -->
	<div class="switchBoxBg">
		<div class="switchBox">
			<p class="titleTxt"><span>关闭</span>设备</p>
			<div style="font-weight: bold;">
				确定<span>关闭</span>设备
				<span class="getDeviceCode"></span>
			</div>
			<label class="labelBox switchLabelBox"></label>
			<div>
				<a class="cancelSwitch">取消</a>
				<a class="okSwitch">确定</a>
			</div>
		</div>
	</div>
@stop


